Questions
36 of 45
1What is a pseudo-element in CSS?
2How are pseudo-elements different from pseudo-classes?
3What is the syntax of a pseudo-element?
4Name some commonly used pseudo-elements.
5What does the ::before pseudo-element do? What does the ::after pseudo-element do?
6How can you insert content using pseudo-elements?
7What is the difference between :before and ::before? Why were pseudo-elements changed from one colon (:) to two (::) in CSS3?
8What does the ::first-letter pseudo-element do?
9What does the ::first-line pseudo-element do?
10How can you style the first line of a paragraph differently?
11Can pseudo-elements be styled with animations or transitions?
12What’s the difference between using ::before and ::after?
13Can pseudo-elements be positioned using CSS positioning properties? Can pseudo-elements have background images or colors? How can you use pseudo-elements to create shapes or icons?
14Can you use multiple pseudo-elements on the same element?
15What is the ::selection pseudo-element used for?
16How does stacking and z-index affect pseudo-elements?
17Can pseudo-elements have child elements or content inside them?
18Can you apply pseudo-elements to replaced elements (like <img>)?
19How do pseudo-elements interact with display and overflow properties?
20What’s the difference between using pseudo-elements and real elements for decoration?
21How does inheritance work with pseudo-elements?
22Can pseudo-elements trigger JavaScript events (like click)?
23How can you control the generated content with pseudo-elements using attr()?
24Can pseudo-elements be used inside flex or grid layouts?
25How do you control the stacking order of ::before and ::after pseudo-elements?
26How can you create a tooltip using pseudo-elements?
27How can you make a custom underline or highlight effect using ::after?
28How can you make a quotation mark appear before a paragraph using pseudo-elements?
29How do you create a triangle or arrow shape using only CSS pseudo-elements?
30How can you use pseudo-elements to add icons without extra markup?
31How can you create a button hover animation using ::before or ::after?
32How can pseudo-elements help in implementing skeleton loaders or shimmer effects?
33How can you use ::before and ::after to clear floats?
34How can you create a border animation using pseudo-elements?
35How can pseudo-elements be used in responsive design?
36What is the ::marker pseudo-element and when is it used?
37What does the ::placeholder pseudo-element do?
38How does ::cue work with media elements?
39What is ::backdrop, and where is it used?
40What is the difference between ::file-selector-button and other input pseudo-elements?
41How does the ::part() pseudo-element work in Web Components?
42How is ::slotted() different from ::part() in shadow DOM styling?
43Can you style text highlights with pseudo-elements?
44How can ::selection be customized for accessibility and branding?
45What are the limitations of pseudo-elements compared to actual DOM elements?
36 / 45

What is the ::marker pseudo-element and when is it used?

Understanding the ::marker Pseudo-Element in CSS

The ::marker pseudo-element is used to style the marker box of list items, such as bullets in unordered lists or numbers in ordered lists. It allows you to customize the appearance of list markers without altering the HTML content.

Key Points
  1. 1

    ::marker targets only the marker portion of <li> elements, not the content text.

  2. 2

    You can style properties like color, font-size, font-weight, and content for the marker.

  3. 3

    Other CSS properties, like margin or padding, generally do not apply to ::marker.

  4. 4

    Useful for customizing bullets, numbers, or symbols in lists to match design aesthetics.

Example: Styling List Markers

In this example, the ::marker pseudo-element changes the bullet color to red, increases its size, and replaces the default bullet with a star symbol. This is all achieved without modifying the HTML structure of the list.

Best Practices
  1. 1

    Use ::marker for purely visual customization of list markers.

  2. 2

    Avoid adding essential content in markers that users need to read, as screen readers may treat them differently.

  3. 3

    Combine with relative units or em for scalable and responsive marker styling.

  4. 4

    Test across browsers, as some older browsers may have limited support for ::marker styling.

Difficulty: 3/10
Topics: ::marker pseudo-element, list styling, CSS custom properties

Scenario Questions

0-2 years experience
  1. 1

    How would you change the color of bullet points in an unordered list to red using CSS?

  2. 2

    What happens if you try to set font-size on ::marker but the list item has no explicit font-size defined?

  3. 3

    You’re told the bullets in a list aren’t showing up — what CSS property might be accidentally set to none?

2-5 years experience
  1. 1

    A designer wants custom checkmark icons instead of bullets in a todo list — how would you implement that with ::marker, and what fallbacks would you consider for older browsers?

  2. 2

    Our list indicators are misaligned after adding a custom font — what debugging steps would you take to fix ::marker positioning?

  3. 3

    Why did our ::marker styles stop working after we switched from ul/li to a div-based component with aria-role?

5-8 years experience
  1. 1

    We’re building a scalable component library with customizable list indicators — how would you design the CSS architecture to support theme-driven ::marker styles without bloating the stylesheet?

  2. 2

    In a high-performance UI with hundreds of dynamic lists, how would you evaluate whether ::marker styling impacts layout reflow or paint performance compared to using pseudo-elements on li?

  3. 3

    How would you handle ::marker styling in a system that supports RTL languages and needs to flip marker positions automatically?

8+ years experience
  1. 1

    We’re migrating a legacy product from list-style-image to ::marker — what cross-browser compatibility risks and accessibility implications must you coordinate across design, engineering, and QA teams?

  2. 2

    How would you architect a CSS strategy for ::marker that supports both modern browsers and legacy enterprise systems without forcing a full CSS reset or polyfill?

  3. 3

    A global design system uses ::marker for hierarchical indicators across 12 product teams — how do you ensure consistency, performance, and maintainability at scale without creating a CSS monolith?

Follow-up Questions

  • Can you style ::marker with background images?
  • What happens if you apply display: none to ::marker?
  • How does ::marker behave in nested lists?